#!/usr/bin/env perl

use FindBin qw($RealBin);

my $base = $RealBin; $base =~ s/\/[a-z]+$//;

die "chdir fail" unless chdir $base;

my $c = `cat node_modules/tty.js/config.json`;

my $port =  $c =~ /"port": (\d+),/ ? $1 : die "get port info fail";

print "start port: $port\n";

system "./node_modules/tty.js/bin/tty.js --config node_modules/tty.js/config.json --daemonize";
